<?php

namespace api\user\controller;

class AdminNoticeController extends \Aaa\AdminController {

    protected function init() {
        $this->baseField = [
            [
                'field' => 'id',
                'name' => 'ID',
            ],
            [
                'field' => 'type',
                'name' => '消息类型',
                'type' => 'select',
                'options' => [
                    ['name' => '系统消息', 'value' => 'system'],
                    ['name' => '管理员消息', 'value' => 'admin'],
                ],
            ],
            [
                'field' => 'user_id',
                'name' => '用户',
            ],
            [
                'field' => 'create_time',
                'name' => '通知时间',
                'type' => 'time',
            ],
            [
                'field' => 'title',
                'name' => '标题',
            ],
            [
                'field' => 'content',
                'name' => '内容',
            ],
            [
                'field' => 'name',
                'name' => '姓名',
            ],
            [
                'field' => 'read',
                'name' => '已读',
                'type' => 'switch',
                'options' => ['已读', '未读'],
            ],
        ];
    }

    protected function beforeIndex() {
        $this->actionField = ['id', 'type', 'user_id', 'create_time', 'title', 'content', 'read',];
        $this->searchField = [
            'common' => [
                'id' => 'accurate',
                'type' => 'accurate',
                'user_id' => 'accurate',
                'title' => 'fuzzy',
                'content' => 'fuzzy',
                'read' => 'accurate',
            ],
            'time' => ['create_time'],
        ];
    }

}